home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 7698 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.3 KB

  1. Path: pegasus.odyssee.net!news
  2. From: imaze@odyssee.net (Marc Mazerolle)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Help with Code
  5. Date: Sun, 25 Feb 1996 05:50:53 GMT
  6. Organization: Odyssee Internet
  7. Message-ID: <4gosil$nht@pegasus.odyssee.net>
  8. References: <4gi3l1$kou@news.voicenet.com> <312C746B.50DA@azstarnet.com>
  9. Reply-To: imaze@odyssee.net
  10. NNTP-Posting-Host: pool21_10.odyssee.net
  11. X-Newsreader: Forte Free Agent v0.55
  12.  
  13. "S. Brenner" <brenner@azstarnet.com> wrote:
  14.  
  15. >This code is from "Tech yourself C++ programming in 21 
  16. >Days"
  17. > But I cannot get it to compile.  I am using Code warrrior gold 
  18. >and ansi C++.
  19.  
  20. >This is the error message I keep getting:
  21.  
  22. >Error   : ambiguous access to overloaded function 
  23. >3.7.c line 9   cin >> DayOff;
  24.  
  25.  
  26. >And this is the Code:
  27.  
  28. >#include <iostream>
  29. >void main()
  30. >{
  31. >    enum Days { Sunday, Monday, Tuesday, Wednesday, 
  32. >Thursday, Friday, Saturday };
  33. >    
  34. >    Days DayOff;
  35. >    
  36. >    cout << "What day would you like off (0-6)? ";
  37. >    cin >> DayOff;
  38. >    
  39. >    if (DayOff == Sunday || DayOff == Saturday)
  40. >        cout << "\nYou're already off on weekends!\n";
  41. >    else
  42. >        cout << "\nOkay, I'll put in the vacation day.\n";
  43. >}
  44.  
  45. Your books assumes that your compiler will generate an integer
  46. variable for your enum (most compiler do). So cin on an integer should
  47. work fine...
  48.  
  49. Your ANSI switch might be causing the problem.
  50.  
  51.